
#include "TilterSubsystem.h"
#include "EntechPorts.h"

TilterSubsystem::TilterSubsystem():
	EntechSubsystem("Tilter_Subsystem")
	, m_position(kFlat)
{
	m_tilt = new Solenoid(c_tilterChannel);
	m_timer = new Timer();
}

TilterSubsystem::~TilterSubsystem()
{
}

bool TilterSubsystem::CommandDone(void)
{
	return m_timer->HasPeriodPassed(c_TimeToDeploy);
}

void TilterSubsystem::SetPosition(TilterPosition position)
{
	m_position = position;
	m_timer->Stop();
	m_timer->Reset();
	m_timer->Start();
}

void TilterSubsystem::DoTeleop(void)
{
	if ( kTilted == m_position)	{
		m_tilt->Set(true);
	} else {
		m_tilt->Set(false);
	}
}
